package com.example.exception;

public class BusinessException extends CustomException {
    
    public BusinessException(String msg) {
        super(msg, "BUSINESS_ERROR");
    }
    
    public BusinessException(String msg, String code) {
        super(msg, code);
    }
    
    public BusinessException(String msg, Throwable cause) {
        super(msg, "BUSINESS_ERROR", cause);
    }
    
    public BusinessException(String msg, String code, Throwable cause) {
        super(msg, code, cause);
    }
    
    // 常见业务异常
    public static class ValidationException extends BusinessException {
        public ValidationException(String msg) {
            super(msg, "VALIDATION_ERROR");
        }
    }
    
    public static class DataNotFoundException extends BusinessException {
        public DataNotFoundException(String msg) {
            super(msg, "DATA_NOT_FOUND");
        }
    }
    
    public static class DuplicateDataException extends BusinessException {
        public DuplicateDataException(String msg) {
            super(msg, "DUPLICATE_DATA");
        }
    }
    
    public static class UnauthorizedException extends BusinessException {
        public UnauthorizedException(String msg) {
            super(msg, "UNAUTHORIZED");
        }
    }
}